﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Media3D;
using System.Windows.Media.Animation;

namespace Shiny.SmartTravel
{
    /// <summary>
    /// Interaction logic for EarthPage.xaml
    /// </summary>
    public partial class EarthPage : Page
    {
        public EarthPage()
        {
            InitializeComponent();
        }

        private void AnimateScaleTo(double to)
        {
            DoubleAnimation da = new DoubleAnimation();
            da.To = to;
            da.Duration = TimeSpan.FromMilliseconds(500);
            worldScale.BeginAnimation(ScaleTransform3D.ScaleXProperty, da);
            worldScale.BeginAnimation(ScaleTransform3D.ScaleYProperty, da);
            worldScale.BeginAnimation(ScaleTransform3D.ScaleZProperty, da);
        }

        private void AnimateCloudOpacityTo(double to)
        {
            DoubleAnimation da = new DoubleAnimation();
            da.To = to;
            da.Duration = TimeSpan.FromMilliseconds(500);
            cloudsBrush.BeginAnimation(VisualBrush.OpacityProperty, da);
        }

        private void worldContainer_MouseEnter(object sender, MouseEventArgs e)
        {
            AnimateScaleTo(1.5);
            AnimateCloudOpacityTo(0);

        }

        private void worldContainer_MouseLeave(object sender, MouseEventArgs e)
        {
            AnimateScaleTo(1);
            AnimateCloudOpacityTo(1);
        }
    }
}
